<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <button class = 'btn1'>开始</button>
    <button class = 'btn2'>暂停</button>
    <script>
        var count = 60;
        var divEle = document.querySelector('div')
        var btn1Ele = document.querySelector('.btn1')
        var btn2Ele = document.querySelector('.btn2')
        var timer;
        divEle.innerHTML = count;
        btn1Ele.onclick = function(){
            timer = setInterval(function(){
            count--;
            if(count >=0){
                divEle.innerHTML = count;
            }else{
                clearInterval(timer)
            }
            },1000)
        }
        btn2Ele.onclick = function(){
            clearInterval(timer)
        }
    </script>
</body>
</html>